/**
 * 
 */
function getSlug(str){
	//bỏ dấu
	var from = "àáạảãâầấậẩẫăằắặẳẵèéẹẻẽêềếệểễìíịỉĩòóọỏõôồốộổỗơờớợởỡùúụủũưừứựửữỳýỵỷỹđ";
    var to = "aaaaaaaaaaaaaaaaaeeeeeeeeeeeiiiiiooooooooooooooooouuuuuuuuuuuyyyyyd";
    str = str.toLowerCase();
    for (var i = 0; i < from.length; i++) {
    	str = str.replace(new RegExp(from.charAt(i), 'g'), to.charAt(i)); 
    }
    //đổi dấu cách thành -
    str = str.replace(new RegExp(' ', 'g'),'-'); // trim
   
    return str;
}
$(document).ready(function(){
	$(".chkAll").click(function(){
		var checked = $(this).attr("checked");
		if(checked){
			$(".chkId").attr("checked", true);
		}else{
			$(".chkId").attr("checked", false);
		}
	});
	$(".chkId").click(function(){
		var arrChkId = $(".chkId");
		var length = arrChkId.length;
		var num = 0;
		for(var i =0; i< length; i++){
			if(arrChkId.eq(i).attr("checked")){
				num++;
			}else{
				break;
			}
		}
		if(num== length){
			$(".chkAll").attr("checked", true);
		}else{
			$(".chkAll").attr("checked", false);
		}
	});
});
